const FileNameSchema = {
    name: {type: 'string', required: true}
}
const FilePathSchema = {
    path: {type: 'string', example: '/test'}
}

export const RenameFilePathSchema = {
    srcFile: {type: 'string', required: true},
    dstFile: {type: 'string', required: true}
}

const FileUploadSchema = {
    rewrite: { type: 'boolean'},
    search: {type: 'boolean'},
    versioning:{type:'boolean'},
    isPublic:{ type:'boolean'},
    groupShare:{type:'boolean'}
}

export const FileSchema = {
    ...FileNameSchema, ...FilePathSchema, ...FileUploadSchema,data: {
        "anyOf": [
            {
                type: "string"
            },
            {
                type: "object"
            }
        ]
    }
}

export const FileFavoriteSchema = {
    ...FileNameSchema, ...FilePathSchema,
    favorite: {type: 'boolean', required: true}
}

export const FileSearchSchema = {
    pattern: { type: 'array', items: {type:'string'} },
    orderBy: {type: 'array', items: {type:'object', properties: {prop: {type:"string",enum:['size','lastmodified','name'],default:'lastmodified'},ascending:{type:"boolean",default:false}}}},
    limit: {type: 'number',default:1000},
    offset: {type: 'number',default:0},
    showHidden:{type:'boolean',default:false},
    treeMode:{type:'boolean',default:false},
    path:{type:'string'}
}
